package com.qianfeng.test;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;

import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BaiduMapOptions;
import com.baidu.mapapi.map.MapStatus;
import com.baidu.mapapi.map.MapStatusUpdate;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.model.LatLng;

/**
 * Created by Administrator on 15-7-27.
 */
public class MapLocationActivity extends AppCompatActivity {
    private MapView mapView;
    private BaiduMap baiduMap;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.map_location_activity);

        initView();
        //        newView();
    }

    private void newView() {
        BaiduMapOptions options = new BaiduMapOptions();
        options.compassEnabled(true);
        MapStatus.Builder builder = new MapStatus.Builder().target(new LatLng(39.963175, 116.400244)).zoom(18);
        options.mapType(BaiduMap.MAP_TYPE_NORMAL);
        options.mapStatus(builder.build());
        options.scaleControlEnabled(true);
        options.zoomControlsEnabled(false);
        options.zoomGesturesEnabled(true);
        mapView = new MapView(this, options);
    }


    private void initView() {
        mapView = (MapView) this.findViewById(R.id.mapView_seller);
        baiduMap = mapView.getMap();

        /**
         * 璁剧疆鍦板浘鏄剧ず鐨勭被鍨?         *
         * BaiduMap.MAP_TYPE_SATELLITE 鍗槦鍥?         * BaiduMap.MAP_TYPE_NORMAL 2D骞抽潰鍥?         */

        baiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
        /**
         * 鍚敤浜ら€氬疄鍐?         */
        baiduMap.setTrafficEnabled(true);
        /**
         * 璁剧疆鏄剧ず鐑姏鍥?         */
        baiduMap.setBaiduHeatMapEnabled(true);
        baiduMap.setMaxAndMinZoomLevel(3, 20);
        LatLng latLng = new LatLng(39.963175, 116.400244);
        MapStatusUpdate update = MapStatusUpdateFactory.newLatLngZoom(latLng, 18f);
        baiduMap.setMapStatus(update);
    }


}
